<?php
namespace app\admin\controller;
use app\admin\model\Menus;
use app\admin\model\Campus;
use app\admin\model\Student;
use app\admin\model\Classes;
use app\admin\model\Teacher;
use think\Controller;
use think\Db;
/**
 * 后台主页
 * Class IndexController
 * Author ghostsf
 * Blog www.ghostsf.com
 * @package app\admin\controller
 */
class IndexController extends CommonController
{
    /**
     *
     * @return mixed
     */
    public function index()
    {
        $userSession = session('loginSession');
        if (!$userSession) {
            $this->setGlobalSettings(["GlobalTitle", "LoginPageTitle", "DialogClassSpeed", "DialogClassAnimation", "LoginPageSTitle"]);
            return $this->fetch('index');
        } else {
            $this->setGlobalSettings(["DialogClassSpeed", "DialogClassAnimation", "GlobalTitle", "BackGroundTitle"]);
            $this->setPersonalSettings(["openAnimation"]);
            $menus = Menus::all();
            $menunames = array();
            $menuicons = array();
            foreach ($menus as $menu) {
                $menunames[$menu['menu_value']] = $menu['menu_name'];
                $menuicons[$menu['menu_value']] = $menu['menu_iconclass'];
            }
            $this->assign("menunames", $menunames);
            $this->assign("menuicons", $menuicons);
            $this->assign("user", $userSession);
            return $this->fetch('admin');
        }
    }
}
